'use strict';

var koa = require('koa'),
    xtpl2 = require('xtpl2'),
    serve = require('koa-static'),
    session = require('koa-session');

var app = koa();

app.keys = ['money-jar'];
app.context.render = xtpl2.koaRender({
    views: 'app/views'
});

app.use(require('koa-bodyparser')());
app.use(serve('assets'));
app.use(session());

// setup portal routes
require('./app/routes/')(app);


app.listen(process.env.PORT || 3000, function() {
    console.info('listening on port %s', this.address().port);
});
